package com.litch.mvpdemo.utils;

import okhttp3.Callback;
import okhttp3.OkHttpClient;
import okhttp3.Request;

/**
 * Created by Administrator on 2016/7/11.
 */
public class HttpUtil {
    public static HttpUtil instence;
    private OkHttpClient client;
    private HttpUtil(){
        client = new OkHttpClient();
    }
    public static HttpUtil getInstence(){
        if(instence == null){
            instence = new HttpUtil();
        }
        return instence;
    }
    public void doGet(String url, Callback callback){
        Request.Builder builder = new Request.Builder();
        builder.url(url);
        builder.addHeader("apikey","9d66ec1c90fa5fe2a82f8ab10d5cfe04");
        Request request = builder.build();
        client.newCall(request).enqueue(callback);
    }
}
